package net.apexcns.core.spring;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;

import collector.task.JobTaskVO;


public abstract class CoreMultiActionController extends MultiActionController {
	protected Logger logger = Logger.getLogger(getClass());

	protected void bind(HttpServletRequest request, Object command) throws Exception {
		super.bind(request, command);
		if(command instanceof JobTaskVO) {
		    JobTaskVO cmmvo = ((JobTaskVO) command);
			cmmvo.setRemoteIp(request.getRemoteAddr());
			//cmmvo.setUserAgent(request.getHeader("User-Agent"));
		}
	}

	protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		return super.handleRequestInternal(request, response);
	}

}